<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
    <head>
	    <meta http-equiv="content-type" content="text/html; charset=utf-8">
		<link rel="stylesheet" type="text/css" href="/stylesheets/main.css">
		<script language="javascript">
		    function request_test(){
			    var req = new XMLHttpRequest();
				req.open("GET", "/osimtest/execute/", true);
				req.send(null);
			}
			
			function send_url(){
			    var req = new XMLHttpRequest();
				var urlinput = document.getElementById("site_input");
				if (urlinput.value) {
				    req.open("POST", "/osimtest/seturl/", true);
					req.send(urlinput.value);
				} else {
				}
			}
		</script>
		<script language="javascript">
			window.onscroll = function() {
				var fl = document.getElementById("tabs");
				var originalPos = fl.offsetTop;
				var current;
				if(document.documentElement && document.documentElement.scrollTop) {
				    current = fl.offsetTop - document.documentElement.scrollTop;
				} else {
				    current = fl.offsetTop - document.body.scrollTop;	
				}
				
				if(current >= 0) {
				    fl.className = "al fl";
					fl.style.top = "0px";
					fl.style.width = "950px";
					//fl.style.height = "22px";
				} 
				if(current == originalPos) {
				    fl.className = "al";
					fl.style.top = "";
					fl.style.width = "";
					//fl.style.height = "";
				}
			}
		</script>
	</head>
    <body id="main_page">
		<div id="header">
		    <h1>OSIM Automation</h1>
			<div id="tabs" class="al">
		        <ul id="tabs">
				    <li>
					    <a href="/osimtest/index">Control Panel</a>
				    </li>
				    <li>
					    <a href="/osimtest/report">Test Results</a>
				    </li>
			    </ul>
			</div>
		</div>
		
	    <div id="control_panel">
			<div style="height: 20px"></div>			
			<div id="test_site" class="section">
			    <div id="site">
				    <h1 class="subtitle">Test Site</h1>
				    <div id="input_submit">
					    <input type="text" id="site_input">
						<button name="submiturl" type="button" onclick="send_url()">
				            <span>submit</span>
				        </button>
					</div>
				</div>
			</div>
			
			<div id="upload_file" class="section">
			    <h1 class="subtitle">Upload case file:</h1>
				<div class="file-upload-btn">
				    <label for="uploader"></label>
				    <form action="/osimtest/upload/" method="POST" enctype="multipart/form-data" name="form">
						<input type="file" name="file" id="uploader">
						<input type="submit" name="Submit upload" value="Upload">
					</form>
				</div>
				<div id="upload_progress">
				    <div>
					    <div id="progress_bar"></div>
					</div>
				</div>
			</div>
			
			<div id="start-test" class="section">
			    <h1 class="subtitle">Start Automation Test</h1>
				<div id="start-btn">
				   <button name="Start Test" type="submit" onclick="request_test()">
				       <span>Start Test</span>
				   </button>
				</div>
				<div>
				</div>
				<div>
				</div>
			</div>
			
			<div id="progress" class="section">
			    <h1 class="subtitle">Progress:</h1>
		    </div>
			
		</div>
		
	</body>
</html>
